#include <bits/stdc++.h>
using namespace std;

int main() {
    int N, D;
    cin >> N >> D;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    
    vector<bool> used(N, false);
    int count = 0;
    
    for (int i = 0; i < N; ++i) {
        if (!used[i]) {
            count++;
            int Y = A[i] + D;
            auto it = lower_bound(A.begin(), A.end(), Y);
            if (it != A.end() && *it == Y) {
                int j = it - A.begin();
                used[j] = true;
            }
        }
    }
    
    cout << count << endl;
    return 0;
}
